<template>
	<view class="user-list-li" @click="clickLookUser">
		<view class="user-info-preview">
			<userAvatar :size="130" :src="data.avatar" radius="50%"></userAvatar>
			<view class="user-info">
				<view class="user-info-header">
					<userName :username="data.username"></userName>
				</view>
				<view class="user-info-block">
					<view class="user-info-block-tab">
						<template v-if="data.gender == 1">
							<wd-icon class="user-gender-icon user-gender-male-color" name="gender-male" />
						</template>
						<template v-if="data.gender == 2">
							<wd-icon class="user-gender-icon user-gender-female-color" name="gender-female" />
						</template>
						<text>26岁</text>
					</view>
					<view class="user-info-block-tab">
						<text class="user-info-address-sheng">广东</text>
						<text class="user-info-address-sheng"> · </text>
						<text class="user-info-address-sheng">惠州</text>
					</view>
					<view class="user-info-block-tab">
						<text class="user-info-address-sheng">IP</text>
						<text class="user-info-address-sheng"> : </text>
						<text class="user-info-address-sheng">惠州</text>
					</view>
				</view>
				<text class="user-info-registered">注册时间:{{data.register_time}}</text>
			</view>
		</view>

		<view class="user-info-tips">

		</view>
		<view class="user-option" v-if="false">
			<view class="user-option-li">
				<wd-button type="info" size="small" :round="false" plain hairline @click="clickLookUser">查看</wd-button>
			</view>
			<view class="user-option-li">
				<wd-button type="error" size="small" :round="false" plain hairline
					@click="clickRemoveUser">删除</wd-button>
			</view>
		</view>
	</view>
</template>

<script setup>
	import userName from '@/components/user_name_text/user_name_text.vue';
	import userAvatar from "@/components/user_avatar/user_avatar.vue"
	defineProps(["data"])
	const Emits = defineEmits(["clickLookUser", "clickRemoveUser", "clickLockUser"])
	// 点击查看用户
	function clickLookUser(user) {
		Emits("clickLookUser")
	}
	// 点击删除用户
	function clickRemoveUser(user) {
		Emits("clickRemoveUser")
	}
	// 点击锁定用户
	function clickLockUser(user) {
		Emits("clickLockUser")
	}
</script>

<style scoped>
	.user-info-preview {
		display: flex;
		gap: 38rpx;
	}

	.user-list-li:active {
		background: #c3c3c344;
	}

	.user-info-registered,
	.user-info-real {
		font-size: 25rpx;
		color: #c3c3c3;
	}

	.user-avatar {
		position: relative
	}

	.user-info-tips {
		display: none;
		border: 1px solid orange;
		height: 60rpx;
		border-radius: 10rpx;
		margin: 10rpx 0rpx;
	}

	.user-option {
		display: flex;
		justify-content: flex-end;
		margin-top: 25rpx;
		gap: 18rpx;
	}
	
	.user-list-li {
		background: white;
		width: 100%;
		display: flex;
		flex-direction: column;
		padding: 20rpx 28rpx;
		padding-top: 30rpx;
		padding-left: 40rpx;
		padding-bottom: 30rpx;
		box-sizing: border-box;
		border-radius: 15rpx;
		/* border-bottom: 20rpx solid #c3c3c344; */
	}
	.user-info {
		flex: 1;
		overflow: hidden;
	}
	.user-info-header {
		display: flex;
		justify-content: space-between;
	}

	.user-info-state {
		display: inline-block;
		padding: 1px 5px;
		border: 1px solid #c3c3c3;
		font-size: 10px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 3px;
	}

	.user-info-block {
		margin: 0px;
		height: 30rpx;
		margin: 8rpx 0rpx;
		margin-top: 10rpx;
		display: flex;
		align-items: center;
		gap: 10rpx;
	}

	.user-info-block-tab {
		padding: 3rpx 8rpx;
		font-size: 20rpx;
		border-radius: 6rpx;
		background-color: #d5dde161;
		color: #6f6b6b;
	}

	.user-info-block-tab-gender-male {
		color: #229ee9;
		font-weight: bold;
	}

	.user-gender-female-color {
		color: #e10000;
		font-weight: bold;
	}

	.user-info-username {
		font-size: 35rpx;
	}

	.user-gender-icon {
		margin-right: 6rpx;
	}

	.user-gender-male-color {
		color: #229ee9;
		font-weight: bold;
	}
</style>